// src/renderer/utils/webSocket.ts
import { useWebSocket } from "@vueuse/core";
const { status, data, send, open, close } = useWebSocket(
    "ws://127.0.0.1:8092/websocket/1",
    {
        autoReconnect: true,
        heartbeat: {
            message: JSON.stringify({ serviceType: "ping" }),
            interval: 30000,
            pongTimeout: 30000,
        },
    }
);


// 新增 sendMessage 方法
function sendMessage(message) {
    send(message);
}
export default {
    status,
    data,
    send,
    open,
    close,
    sendMessage // 暴露 sendMessage 方法
};